﻿

using System.Collections.Generic;

namespace SuperScrollView
{
    public class TreeViewItemData
    {
        public bool mDefaultExpand = false;
        public int mChildCount;
        public int ChildCount
        {
            get { return mChildCount; }
        }
        public bool IsVaild(int index)
        {
            if (index < 0 || index >= mChildCount)
            {
                return false;
            }
            return true;
        }
    }
    public class TreeViewDataSource
    {
        public List<TreeViewItemData> mItemDataList = new List<TreeViewItemData>();
        public TreeViewItemData GetItemDataByIndex(int index)
        {
            if (index < 0 || index >= mItemDataList.Count)
            {
                return null;
            }
            return mItemDataList[index];
        }

        public int TreeViewItemCount
        {
            get
            {
                return mItemDataList.Count;
            }
        }

        public int TotalTreeViewItemAndChildCount
        {
            get
            {
                int count = mItemDataList.Count;
                int totalCount = 0;
                for (int i = 0; i < count; ++i)
                {
                    totalCount += mItemDataList[i].ChildCount;
                }
                return totalCount;
            }
        }
    }
}
